package com.asm.repository;

import com.asm.entity.sys.Spot;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

/**
 * @author ZhuangGuiMan
 */
@Repository
public interface SpotRepository extends JpaRepository<Spot, Long> {
    /**
     * 根据广告类型分页查询广告位
     * @param type
     * @param pageable
     * @return
     */
    public Page<Spot> findBySpotType(String type, Pageable pageable);

    /**
     * 根据广告大小分页查询广告位
     * @param size
     * @param pageable
     * @return
     */
    public Page<Spot> findBySpotSize(String size, Pageable pageable);

    @Query("select c from Spot c where c.isDel=false ")
    Page<Spot> findAll(PageRequest of);
}
